File System:

It belongs to the package java.io
It is mailny used to perform file & directory (Folder) related operations.

Classes in java.io package:

1. File

Q: How to create object to the File class?
Ans:
(1) File f1 = new File("C:\\CoreJava\\Sample.txt");

(2) File f1 = new File("C:\\CoreJava", "Sample.txt");

(3) File f1 = new File("C:\\CoreJava\\Sample.txt");
	File f2 = f1;
	
(4) File f1 = new File("C:\\CoreJava\\Sample.txt");
	File f2 = new File(f1.toString());
	
--------------------------------------------------------	
File class is used for file & Directory operations which are as follows:

I. File operations
(a) createNewFile(): to create a new blank file. Returns boolean
(b) renameTo(): to rename files OR to move (Cut & paste) files. returns boolean
(c) delete(): to delete the files which returns boolean.
(d) deleteOnExit(): to delete the files. It is void
(e) File attributes: to use all the file attributes
(f) File collections: to work with collection of files.


II. directory Operations
(a) mkDir(): to create a blank directory. It returns boolean
(b) mkDirs(): to create a nested directories. It returns boolean
(c) renameTo(): to rename OR to move the directories. It returns boolean
(d) delete(): to delete the directory which returns boolean
(e) deleteOnExit(): to delete directory which is void
(f) Directory attributes: to use all the directory attributes
(g) Directory collections: to work with collection of directories.

Note: using File class we can't perform read & write operations as it is not a Stream class.
========================================

Stream classes in File System for read & write purpose:
2 types of stream classes:
(i) byte stream classes
   (a) FileInputStream: Its used for reading purpose. It reads the file content in the form of int & byte. FileInputStream class extends InputStream abstrct class.
   It reads character by character & convert them into int/byte and returns it.

   (b) FileOutputStream: Its used for writing purpose. It writes to the file in the form of int, byte. FileOutputStream class extends OutputStream abstract class.
   It writes character by character in the form of int/byte.

(ii) character stream classes
   (a) FileReader: Its used for reading purpose. It reads the file content in the form of int, char. The FileReader class extends Reader abstract class.
   It reads character by character & convert them into int OR char and returns it.
   
	
   (b) FileWriter: Its used for writing purpose. It writes to the file in the form of int, char & String. The FileWriter class extends Writer abstract class
   It writes character OR words(String) in the form of int & String Respectively.


  (c) BufferedReader: Its used for reading purpose. It reads the file content in the form of int, char, String (line by line)

    BufferedReader constructor accepts FileReader as a input.

  (d) BufferedWriter: Its used for writing purpose. It writes the content to the file in the form of int, char, String & newLine.

   BufferedWriter constructor accepts FileWriter as a input.
   
   
===================
Q1: How to find how many files & directories present?
Q2: Find how many lines in a given text file?
Q3: Compare 2 text files?
Q4: Read only alternative lines from the file?
Q5: Read from the file & write to another file in reverse order?
Q6: Read from the file & store in the array.
Q7: A directory contains multiple files delete only .txt files?
Q8: A directory contains multiple files rename only .xlsx files?
Q9: A directory contains multiple files rename only .txt files?
Q10: A directory with 7 files, rename them to weekday names?
Q11: A directory contains multiple files find how many .txt, .xlsx & .docx files present?
Q12: File contains some content. Find how many lines, words & characters are present?
Q13: Create nested Directories without using .mkDirs() method?
Q14: Read Nested Directories using recursive?
Q15: Difference between FileInputStream & FileReader
Q16: There is a File with Sample.txt. Verify that the file is present & rename it to AAAA.txt?
Q17: create 5 excel files?
=============================================

Serialization & De-serialization
